package cn.org.timespace.easyframe.dao.permission.impl;

import java.util.List;

import cn.org.timespace.easyframe.dao.EfBaseDAO;
import cn.org.timespace.easyframe.dao.permission.EfOrgDAO;
import cn.org.timespace.easyframe.model.permission.EfOrg;

/**
 * A data access object (DAO) providing persistence and search support for EfOrg
 * entities. Transaction control of the save(), update() and delete() operations
 * can directly support Spring container-managed transactions or they can be
 * augmented to handle user-managed Spring transactions. Each of these methods
 * provides additional information for how to configure it for the desired type
 * of transaction control.
 * 
 * @see cn.org.timespace.easyframe.dao.permission.impl.EfOrg
 * @author MyEclipse Persistence Tools
 */

public class EfOrgDAOImpl extends EfBaseDAO implements EfOrgDAO {

	public void save(EfOrg transientInstance) {
		log.debug("saving EfOrg instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(EfOrg persistentInstance) {
		log.debug("deleting EfOrg instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public EfOrg findById(java.lang.String id) {
		log.debug("getting EfOrg instance with id: " + id);
		try {
			EfOrg instance = (EfOrg) getHibernateTemplate().get(
					"cn.org.timespace.easyframe.model.permission.EfOrg", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List<EfOrg> findAll() {
		log.debug("finding all EfOrg instances ");
		try {
			String queryString = "from EfOrg order by displayNo asc ";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public void update(EfOrg instance) {
		getHibernateTemplate().update(instance);
	}
}